package pers.cz.service.impl;

import pers.cz.business.KnowLedgeBaseBusiness;
import pers.cz.model.AutoCollectTestCaseSql;
import pers.cz.model.BusinessKnowLedgeTree;
import pers.cz.model.KnowLedgeBaseBusi;
import pers.cz.pub.BeanHelper;
import pers.cz.service.KnowLedgeBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @program: PostGirl-panent
 * @description: KnowLedgeBaseServiceImpl
 * @author: Cheng Zhi
 * @create: 2021-07-07 08:52
 **/
@Service
public class KnowLedgeBaseServiceImpl implements KnowLedgeBaseService {

    @Autowired
    private BeanHelper beanHelper;

    @Override
    public List<KnowLedgeBaseBusi> queryAllKnowLedgeBaseBusi() {

        KnowLedgeBaseBusiness business = new KnowLedgeBaseBusiness();
        business.setMapper(beanHelper);

        return business.queryAllKnowLedgeBaseBusi();
    }

    @Override
    public List<KnowLedgeBaseBusi> queryKnowLedgeBaseBusiByKeyWord(String keyWord) {

        KnowLedgeBaseBusiness business = new KnowLedgeBaseBusiness();
        business.setMapper(beanHelper);

        return business.queryKnowLedgeBaseBusiByKeyWord(keyWord);
    }

    @Override
    public List<String> getDownLoadRank() {
        return null;
    }

    @Override
    public Integer addKonwLedgeNode(BusinessKnowLedgeTree businessKnowLedgeTree) {

        KnowLedgeBaseBusiness business = new KnowLedgeBaseBusiness();
        business.setMapper(beanHelper);

        return business.addBusinessNode(businessKnowLedgeTree);
    }

    @Override
    public Integer deleteKonwLedgeNode(Integer id) {
        KnowLedgeBaseBusiness business = new KnowLedgeBaseBusiness();
        business.setMapper(beanHelper);

        return business.deleteBusinessNode(id);
    }

    @Override
    public List<BusinessKnowLedgeTree> queryAllBusinessKnowLedgeTree() {

        KnowLedgeBaseBusiness business = new KnowLedgeBaseBusiness();
        business.setMapper(beanHelper);

        return business.queryAllBusinessNode();
    }

    @Override
    public Integer updateKnowLedgeNode(BusinessKnowLedgeTree businessKnowLedgeTree) {
        KnowLedgeBaseBusiness business = new KnowLedgeBaseBusiness();
        business.setMapper(beanHelper);

        return business.updateBusinessNode(businessKnowLedgeTree);
    }

    @Override
    public List<String> getAllBusiCode() {
        KnowLedgeBaseBusiness business = new KnowLedgeBaseBusiness();
        business.setMapper(beanHelper);
        return business.getAllBusiCode();
    }

    @Override
    public List<AutoCollectTestCaseSql> getAllSqlByBusiCode(String busiCode) {

        KnowLedgeBaseBusiness business = new KnowLedgeBaseBusiness();
        business.setMapper(beanHelper);
        return business.getAllSqlByBusiCode(busiCode);
    }
}
